import 'package:boss/color_constant.dart';
import 'package:boss/ui/page/commodity/categories/page/plusCommodityMode/page/plusPackage/widget/package_panel.dart';
import 'package:boss/ui/page/takeoutManagement/page/packagingFeeSetting/provider/package_provider.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'packaging_rule_row.dart';

class PackagingRulePanel extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return PackagePanel(
      title: '包装盒计费规则',
      titleStyle: TextStyle(
        fontSize: 32.sp,
        color: ColorConstant.ff33,
        fontWeight: FontWeight.w500,
      ),
      headerPadding: EdgeInsets.all(0),
      children: <Widget>[
        Consumer<PackageProvider>(
          builder: (context, provider, _) {
            return Column(
              children: <Widget>[
                PackagingRuleRow(
                  initFirstValue: '1',
                  initSecondValue: AmountUtil.price2String(provider.data.costAmount),
                  onSecondChanged: (value) {
                    provider.setPackingFee(value);
                  },
                ),
              ],
            );
          },
        ),
      ],
    );
  }
}
